//
//  SettingCell.m
//  edu
//
//  Created by baobaodp on 13-8-27.
//  Copyright (c) 2013年 baobaodp. All rights reserved.
//

#import "SettingCell.h"

@implementation SettingCell

@synthesize title;
@synthesize value;
@synthesize imageView;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void) setData:(Record *) record index: (int) rowIndex
{
    self.title.text = [record getFieldValueByName:@"title"];
    self.value.text = [record getFieldValueByName:@"value"];
    
    
    if([[record.fields allKeys] containsObject:@"img"]){
        UIImage *img=[UIImage imageWithData:[record getFieldDataByName:@"img"]];
        if(img != nil){
            self.imgView.image =img;
            if([[record getFieldValueByName:@"title"] isEqualToString:@"头像"]){
                self.imgView.frame = CGRectMake(210, 5, 70, 70);
            }
        }
    }else{
        self.imgView.hidden = YES;
    }
    
}

@end
